#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <stack>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const double pi=acos(-1);
const int N=510;
double point[N];
void solve()
{
	double n,m;
	cin>>n>>m;
	double theta=pi/m;
	double ans=0;
	double cir=0;
//	cout<<theta<<endl;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<m;j++)
		{
			double t=theta*j;
//			cout<<t*i<<endl;
			point[i]+=min(2.0*i,t*i*1.0);
		}
//		cout<<point[i]<<endl;
		point[i]*=2.0;
		point[i]+=i*2.0;
		
		ans+=point[i]*m;
		ans+=(cir+(i-1.0)*2.0*m)*2.0*m;
		cir+=point[i]+(i-1)*m*2.0;
	}
	if(m>1)
	{
		ans+=(n+1.0)*n*m;
	}
	printf("%.10lf",ans);
}
int main()
{
	IOS;
	int T=1;
//	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

